﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace park.ModelCode
{
    public partial class ModelCodeSearch : System.Web.UI.Page
    {

        public string ModelID = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ModelID = fix("id");
                string method = Request.Params["method"];
                if (!string.IsNullOrEmpty(method))
                {
                    switch (method)
                    {
                        case "search":
                            PrintResult();
                            break;
                        default:
                            Response.End();
                            break;
                    }
                }
            }
        }

        string fix(string key)
        {
            if (Request.Params[key] != null)
            {
                try
                {
                    return Uri.UnescapeDataString(Request.Params[key]);
                }
                catch
                {
                    return Request.Params[key];
                }
            }
            return "";
        }
        private void PrintResult()
        {

            #region 正式代码
            string strID = fix("id");
            string strCode = fix("code");
            int page = int.Parse(fix("page"));
            int size = int.Parse(fix("size"));

            cn.linkit.epark.ServiceList sl = new cn.linkit.epark.ServiceList();

            string json = sl.GetModelCodeList(strID,strCode, page, size);

            Response.Write(json);
            Response.End();
            #endregion

            #region 测试代码
            //测试代码---------------------------
            #endregion


        }
    }
}